<template>
  <!-- 头像组件 -->
  <view class="custom-avatar">
    <tm-avatar :size="size" :img="img" v-if="img"></tm-avatar>
    <avatar
      v-else
      :userName="orgCtl.user.name"
      :width="'40px'"
      :height="'40px'"
      :lineHeight="'40px'"
      :fontSize="'16px'"
    ></avatar>
    <view class="custom-avatar-title" v-if="title">{{ title }}</view>
  </view>
</template>

<script lang="ts" setup>
import avatar from '../avatar/avatar.vue'
import orgCtl from '@/ts/controller'
type Props = {
  title?: string
  size?: number
  img?: string
}
const props = defineProps<Props>()
const { title, size, img } = props
</script>

<style lang="scss">
.custom-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  .custom-avatar-title {
    margin-left: 12rpx;
    font-size: 36rpx;
    color: #000;
    font-weight: 600;
  }
}
</style>
